Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/helper-compilation-targets

Package Overview
Dependencies
Maintainers
4
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-compilation-targets

Helper functions on Babel compilation targets

  • 7.25.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
47M
increased by5.72%
Maintainers
4
Weekly downloads
 
Created

What is @babel/helper-compilation-targets?

The @babel/helper-compilation-targets package is a helper utility used by Babel to determine which JavaScript language features need to be transformed based on the specified compilation targets, such as browsers or Node.js versions. It helps in generating the most efficient and compatible code for the specified environments.

What are @babel/helper-compilation-targets's main functionalities?

Determining necessary plugins/presets

This feature allows you to determine which Babel plugins or presets are necessary to transform your code based on the specified target environments, such as the last two versions of all browsers or Safari versions greater than 7.

const { default: getTargets, filterItems } = require('@babel/helper-compilation-targets');

const targets = getTargets({
  browsers: ['last 2 versions', 'safari > 7']
});

const plugins = filterItems(
  require('@babel/preset-env/data/plugins'),
  targets,
  { ignoreBrowserslistConfig: true }
);

Customizing target environments

This feature enables customization of the target environments for which you are compiling your code. For example, you can specify that you want to target environments that support ES modules or the current version of Node.js.

const { default: getTargets } = require('@babel/helper-compilation-targets');

const targets = getTargets({
  esmodules: true,
  node: 'current'
});

Other packages similar to @babel/helper-compilation-targets

Keywords

FAQs

Package last updated on 22 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc